import { defineStore } from 'pinia'

const bdParam = {}
bdParam.search_stay_min_num = 2
bdParam.search_stay_max_num = 10
bdParam.depth_max = 6
bdParam.threads_max_num = 4
bdParam.memory_min_num = 1024
bdParam.proxy_url = 2
bdParam.page_load_timeout = 30
bdParam.proxy_ip_interval = 2
bdParam.isUserCustom = 0

export  const useBdStore = defineStore('bdStoreID',{
    state:()=>{
        return {
            search_stay_min_num:bdParam.search_stay_min_num ,
            search_stay_max_num:bdParam.search_stay_max_num ,
            depth_max:bdParam.depth_max,
            threads_max_num:bdParam.threads_max_num ,
            memory_min_num:bdParam.memory_min_num,
            proxy_url:'',
            page_load_timeout:bdParam.page_load_timeout,
            proxy_ip_interval:bdParam.proxy_ip_interval,
            isUserCustom:bdParam.isUserCustom,
            currentMenuPath:'',
            appcdkey:'',
            disclaimer_agree:false,
            app_usage_time_status:0,   //1，可不注册，2，需注册
            app_usage_time_txt:'',
            disclaimer_txt:'' , //权责

        }
    },
    getters:{},
    actions:{
        UP_userCustom(val) {
            if (val==0 || val==1)
                this.isUserCustom = val
            else
                this.isUserCustom =0
           // 1是定制 #0表示默认
        },
        setDisclaimer() {
            this.disclaimer_agree = true
        },
        setAppUsageTimeTxt(val,status) {
            this.app_usage_time_txt = val
            this.app_usage_time_status = status      //2需要注册 ，1不需
        }
    },
    persist: {
        enabled: true, // 开启数据缓存
        strategies: [
            {
                key: "bdstore",
                storage: localStorage,    //在本地win无效
            },
        ],
    }
})

